package org.tech4j.captcha.graphical.model;

import java.util.List;

/**
 * @program: tech4j
 * @description:
 * @author: YuKai Fan
 * @create: 2025/3/4 17:01
 **/
public class GraphicalResult {

    /**
     * 原图片base64
     */
    private String originalImageBase64;

    /**
     * 滑块图片base64
     */
    private String jigsawImageBase64;

    /**
     * 点选文字
     */
    private List<String> wordList;

    /**
     * token
     */
    private String token;

    private String secretKey;

    private String pointValueJson;

    /**
     * 是否成功
     */
    private boolean success;

    private String errorCode;

    private String message;

    public static GraphicalResult ofFailed(String errorCode, String message) {
        return GraphicalResult.Builder.builder()
                .success(false)
                .errorCode(errorCode)
                .message(message)
                .build();
    }

    public String getOriginalImageBase64() {
        return originalImageBase64;
    }

    public void setOriginalImageBase64(String originalImageBase64) {
        this.originalImageBase64 = originalImageBase64;
    }

    public String getJigsawImageBase64() {
        return jigsawImageBase64;
    }

    public void setJigsawImageBase64(String jigsawImageBase64) {
        this.jigsawImageBase64 = jigsawImageBase64;
    }

    public List<String> getWordList() {
        return wordList;
    }

    public void setWordList(List<String> wordList) {
        this.wordList = wordList;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public String getSecretKey() {
        return secretKey;
    }

    public void setSecretKey(String secretKey) {
        this.secretKey = secretKey;
    }

    public String getPointValueJson() {
        return pointValueJson;
    }

    public void setPointValueJson(String pointValueJson) {
        this.pointValueJson = pointValueJson;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public String getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(String errorCode) {
        this.errorCode = errorCode;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }


    public static final class Builder {
        private String originalImageBase64;
        private String jigsawImageBase64;
        private List<String> wordList;
        private String token;
        private String secretKey;
        private String pointValueJson;
        private boolean success;
        private String errorCode;
        private String message;

        private Builder() {
        }

        public static Builder builder() {
            return new Builder();
        }

        public Builder originalImageBase64(String originalImageBase64) {
            this.originalImageBase64 = originalImageBase64;
            return this;
        }

        public Builder jigsawImageBase64(String jigsawImageBase64) {
            this.jigsawImageBase64 = jigsawImageBase64;
            return this;
        }

        public Builder wordList(List<String> wordList) {
            this.wordList = wordList;
            return this;
        }

        public Builder token(String token) {
            this.token = token;
            return this;
        }

        public Builder secretKey(String secretKey) {
            this.secretKey = secretKey;
            return this;
        }

        public Builder pointValueJson(String pointValueJson) {
            this.pointValueJson = pointValueJson;
            return this;
        }

        public Builder success(boolean success) {
            this.success = success;
            return this;
        }

        public Builder errorCode(String errorCode) {
            this.errorCode = errorCode;
            return this;
        }

        public Builder message(String message) {
            this.message = message;
            return this;
        }

        public GraphicalResult build() {
            GraphicalResult graphicalResult = new GraphicalResult();
            graphicalResult.setOriginalImageBase64(originalImageBase64);
            graphicalResult.setJigsawImageBase64(jigsawImageBase64);
            graphicalResult.setWordList(wordList);
            graphicalResult.setToken(token);
            graphicalResult.setSecretKey(secretKey);
            graphicalResult.setPointValueJson(pointValueJson);
            graphicalResult.setSuccess(success);
            graphicalResult.setErrorCode(errorCode);
            graphicalResult.setMessage(message);
            return graphicalResult;
        }
    }
}
